﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>jb-aptech毕业设计项目</TITLE>
<meta name="renderer" content="ie-comp">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../../css/style.css" rel="stylesheet" type="text/css">
<script src="script/common.js"></script>
<script src="script/validate.js"></script>
    <script type="text/javascript" src="/js/jquery.min.js"></script>
    <script type="text/javascript" src="/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="/js/vue.js"></script>
    <link rel="stylesheet" href="/css/bootstrap.min.css" type="text/css"></link>
</head>
  	<script type="text/javascript">
  		function myAdd(){
  			document.sysUserForm.submit();
  		}
  	</script>
  <body>
    <div class="page_title">权限管理 > 用户管理 > 系统用户</div>
    <div id="edit">
    <form name="sysUserForm" method="post" action="/CRM/sysUser.do">
    	<input type="hidden" name="method" value="editUser">
    	<div class="button_bar">
	   		<button class="common_button" onclick="help('');">帮助</button>
	   		<button class="common_button" @click="back()" type="button">返回</button>
			<button class="common_button" @click="myAdd()" type="button">保存</button>
	   	</div>
	   	<table class="query_form_table">
	   		<tr>
	   			<th>编号</th>
	   			<td>
	   				<input type="text" v-model="sysUser.usr_id" size="20" readonly="readonly">
	   			</td>
	   			<th>用户名</th>
	   			<td>
	   				<input type="text" v-model="sysUser.usr_name" size="20">
	   			</td>
	   		</tr>
	   		<tr>
	   			<th>密码</th>
	   			<td><br><br><input type="password" v-model="sysUser.usr_password">
	   			<br><br></td>
	   			<th>角色</th>
	   			<td>
	   				<input type="hidden" v-model="sysUser.role_name">{{sysUser.role_name}}
	   			</td>
	   		</tr>
	   		<tr>
	   			<th>状态</th>
	   			<td>
	   				<input type="hidden" v-model="sysUser.usr_flag">{{sysUser.usr_flag==1?'正常':'禁用'}}
	   			</td>
	   		</tr>
	   	</table>
	   	<!--<script>-->
				<!--build_validate("sysUser.usrName","用户名不能为空","Limit","1","50");-->
				<!--build_validate("sysUser.usrPassword","密码不能为空","Limit","1","50");-->
		<!--</script>-->
    </form>
    </div>
  </body>
<script>
    var users=new Vue({
        el:"#edit",
        data:{
            sysUser:{
                usr_id:'',
                usr_name:'',
                usr_password:'',
                usr_flag:'',
                role_name:''
            }
        },
        methods:{
            myAdd(){
                $.getJSON("/myAdd",this.sysUser,function(json){
                    if(json.code==200){
                        alert("保存成功");
                        location="/html/~right/user/list.html";
                    }else{
                        alert("保存失败");
                        location="/html/~right/user/edit.html";
                    }
                })
            },
            back(){
                location="/html/~right/user/list.html";
            }
        },
        created(){
            var usr=sessionStorage.getItem("u");
            this.sysUser=JSON.parse(usr);
        }
    });
</script>
</html>
